package com.example.demo.interceptor;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @author lyc
 * @date 2019/8/27.
 */
@Aspect
@Component
public class ResponseHandler {


    @Around("@annotation(org.springframework.web.bind.annotation.ResponseBody)")
    public Object interceptor(ProceedingJoinPoint pjp) throws Throwable {
        //limitRedisTemplate.opsForValue().setIfAbsent("key","aa",10, TimeUnit.SECONDS);
        MethodSignature signature = (MethodSignature) pjp.getSignature();
        Method method = signature.getMethod();
        System.out.println("====================================="+method);
        return pjp.proceed();
    }

}